package campus.aiit.ssl.util.deprecated;

import java.util.HashMap;

/**
 * @author ihaokun
 * @date 2019/12/20 11:21
 */
public class UnderScore2CamelMap extends HashMap<String, Object> {
  @Override
  public Object put(String key, Object value) {
    if (key.contains("_")){
      char[] chars = key.toCharArray();
      StringBuilder builder = new StringBuilder();
      for (int i = 0; i < chars.length; i++) {
        if (chars[i] != '_'){
          builder.append(chars[i]);
        } else {
          builder.append(chars[++i]);
        }
      }
      key = builder.toString();
    }
    return super.put(key, value);
  }
}